Skip to content

Conversation

@uhoreg
Copy link
Member

@uhoreg uhoreg commented Mar 3, 2021

@uhoreg uhoreg marked this pull request as ready for review March 4, 2021 22:18
@uhoreg uhoreg requested a review from a team March 4, 2021 22:18
@jryans jryans changed the title add a function to share decryption keys for room history Add a function to share decryption keys for room history Mar 8, 2021
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the core of this looks good, but I wonder if it would be best to move the nextMessage bit here instead of leaving it at the React layer.

);
result = {
result: plaintext,
message_index: res.message_index,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this instead match the style of other properties...?

Suggested change
message_index: res.message_index,
messageIndex: res.message_index,

} catch (e) {
continue;
}
const index = res.message_index;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update here as well if naming is changed.

* @param {object} devicesByUser a map of user to array of module:crypto/deviceinfo.
* @param {function} nextMessage a function that returns the next Matrix message to
* to share keys for each time it is called. The function should return a
* {module:models/event.MatrixEvent}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should more explicitly say it's a promise of an event.

const encryptedContent = {
algorithm: olmlib.OLM_ALGORITHM,
sender_key: this._olmDevice.deviceCurve25519Key,
ciphertext: {},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be empty...? 🤔

};

const sessionBySenderKey = {};
for (let message = await nextMessage(); message !== undefined; message = await nextMessage()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe test for just message? Other people might return null for example.

* Share the keys with the given users for the given messages.
*
* @param {object} devicesByUser a map of user to array of module:crypto/deviceinfo.
* @param {function} nextMessage a function that returns the next Matrix message to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would a general user of the JS SDK (outside of Element) have any idea what this function should be...?

Either we need much more extensive documentation here, or we should more likely move this function into the JS SDK itself, since at least the draft version doesn't seem to have a UI component.

@jryans
Copy link
Collaborator

jryans commented Mar 30, 2021

I assume this can be closed since we merged #1640 instead.

@jryans jryans closed this Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants